package com.jmoto.android.test;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;

import com.quickblox.core.QBCallback;
import com.quickblox.core.QBSettings;
import com.quickblox.core.result.Result;
import com.quickblox.module.auth.QBAuth;
import com.quickblox.module.locations.QBLocations;
import com.quickblox.module.locations.model.QBLocation;
import com.quickblox.module.users.QBUsers;

public class ReportEventActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_report_event);


        try {
        	QBSettings.getInstance().setSynchronous(true);
        	QBSettings.getInstance().fastConfigInit("880", "6RXAjt2JnexgfMT", "j7Tq6pJLCDUseeS");
			Log.i("QBSettings", " connect" );
			
			QBAuth.authorizeApp(new QBCallback() {
			    @Override
			    public void onComplete(Result result) {
			        // result comes here
			        // check if result success
			        if (result.isSuccess()) {
			        	
			        }
			    }
			});
			
			
			// perform second request
			QBUsers.signIn("nate", "natenate", null);
			// perform third request
			QBLocations.createLocation(new QBLocation(51.633986, -0.110867, "anyone going to Droidcon?"), null);
			QBUsers.signOut(null);
			
			
			// perform second request
			QBUsers.signIn("moto", "motomoto", null);
			// perform third request
			QBLocations.createLocation(new QBLocation(53.429425, -2.954733, "Want to go! I'm in Liverpool right now"), null);
			QBUsers.signOut(null);
			
			
			// perform second request
			QBUsers.signIn("kate", "katekate", null);
			// perform third request
			QBLocations.createLocation(new QBLocation(50.82253, -0.137163, "I'm in Brighton, heading to Victoria"), null);
			QBUsers.signOut(null);
			
			// perform second request
			QBUsers.signIn("toya", "toyatoya", null);
			// perform third request
			QBLocations.createLocation(new QBLocation(37.983445, -1.12989, "I'm Waiting for Droidcon, but in Murcia"), null);
			QBUsers.signOut(null);
			
			
		} catch (Exception e) {
			Log.e("QBSettings", " error" );
			e.printStackTrace();
		}
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_report_event, menu);
        return true;
    }
}
